home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8517 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: newshost.lanl.gov!tanmoy
  2. From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Need HELP by a C hacker....
  5. Date: 02 Mar 1996 19:38:00 GMT
  6. Organization: Los Alamos National Laboratory
  7. Message-ID: <TANMOY.96Mar2123800@qcd.lanl.gov>
  8. References: <4h5mhv$mh9@newsstand.cit.cornell.edu> <4h7qccINN8m9@anvil.ugrad.cs.ubc.ca>
  9. NNTP-Posting-Host: qcd.lanl.gov
  10. Mime-Version: 1.0
  11. Content-Type: text
  12. In-reply-to: c2a192@ugrad.cs.ubc.ca's message of 1 Mar 1996 13:31:56 -0800
  13.  
  14. In article <4h7qccINN8m9@anvil.ugrad.cs.ubc.ca>
  15. c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku) writes:
  16.  
  17. KK: Try:
  18. KK: 
  19. KK: void (* foo(void))(void)
  20. KK: 
  21. KK: {
  22. KK:     return foo;
  23. KK: }
  24.  
  25. A compiler must diagnose the type mismatch between
  26. void(*(*)(void))(void), the type of the expression foo, and
  27. void(*)(void), the return type of foo. My other post in this thread
  28. discusses solutions.
  29.  
  30. KK: 
  31. KK: What is the point of returning a pointer to a function from the function
  32. KK: itself? You can just write "foo" anywhere you need its value. If
  33. you can call 
  34. KK: foo, then you already know its address, so there is no point in
  35. computing it 
  36. KK: inside foo.
  37.  
  38. These are useful in constructing finite state machines, for example.
  39.  
  40. Cheers
  41. Tanmoy
  42. --
  43. tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
  44. Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
  45. Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
  46. <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
  47. internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
  48. fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
  49.